<%@ page language="java" import="java.util.*,shop.dao.*,shop.entity.*"
	pageEncoding="utf-8"%>
<%@ page import="myservlet.OnlineCounter"%>
<html>
<!-- Added by HTTrack -->
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<!-- /Added by HTTrack -->
<head>
<meta charset="UTF-8">

<meta name="description" content="">
<meta name="keywords" content="">



<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link href="css/style.css" media="screen" rel="stylesheet"
	type="text/css">
<link href="css/grid.css" media="screen" rel="stylesheet"
	type="text/css">
<link rel="stylesheet" href="css/jquery.jqzoom.css" type="text/css">

<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/html5.js"></script>
<script src="js/jflow.plus.js"></script>
<script src="js/jquery.carouFredSel-5.2.2-packed.js"></script>
<script src="js/checkbox.js"></script>
<script src="js/radio.js"></script>
<script src="js/selectBox.js"></script>
<script src="js/jquery.jqzoom-core.js"></script>
<script>
	$(document).ready(function() {
		$('.jqzoom').jqzoom({
			zoomType : 'standard',
			lens : true,
			preloadImages : true,
			alwaysOn : false
		});
	});
</script>

<script>
	$(document).ready(function() {
		$("select").selectBox();
	});
</script>

<script>
	$(document).ready(function() {
		$('#wrapper_tab a').click(function() {
			if ($(this).attr('class') != $('#wrapper_tab').attr('class')) {
				$('#wrapper_tab').attr('class', $(this).attr('class'));
			}
			return false;
		});
	});
</script>
<style>
.keleyitable table, td, th {
	border: 1px solid black;
	margin-top: 10px;
}
</style>
<script>
	$(function() {
		$('#list_product').carouFredSel({
			prev : '#prev_c1',
			next : '#next_c1',
			auto : false
		});
		$('#list_banners').carouFredSel({
			prev : '#ban_prev',
			next : '#ban_next',
			scroll : 1,
			auto : false
		});
		$('#thumblist').carouFredSel({
			prev : '#img_prev',
			next : '#img_next',
			scroll : 1,
			auto : false,
			circular : false,
		});
		$(window).resize();
	});
</script>
<script>
	$(document).ready(function() {
		$("button").click(function() {
			$(this).addClass('click')
		});
	})
</script>
<script type="text/javascript">
	function fun_check_form() {
		var gun = document.getElementById('grade').value;
		if (document.getElementById('text').value == "") {
			alert("请输入评论的内容");
			return false;
		} else if (document.getElementById('text').value.length < 5) {
			alert("请输入大于5字以上");
			return false;
		} else if (document.getElementById('text').value.length > 200) {
			alert("请输入小于200字以下");
			return false;
		} else if (document.getElementById('grade').value == "") {
			alert("请输入评论等级。");
			return false;
		} else if (isNaN(gun) == true) {
			alert("请输入整数值！！");
			return false;
		} else if (document.getElementById('grade').value < 0) {
			alert("请输入评论等级,范围是1到10。");
			return false;
		} else if (document.getElementById('grade').value > 10) {
			alert("请输入评论等级,范围是1到10。");
			return false;
		} else {
			return true;
		}
	}
</script>
<!-- 数据库连接 -->
<%
	response.setCharacterEncoding("utf-8");
	ProductDao pt = new ProductDao();
	CommentDao commentdao = new CommentDao();
	TypeDao pt1 = new TypeDao();
	List pl2 = pt1.findmain_type();

	String p_id = request.getParameter("p_id");
	ProductDao productDao = new ProductDao();
	Product pd = productDao.findProductByID(p_id);

	List P2 = pt.findProductBYtypelist(pd.getP_type());

	List commentList = (List) commentdao.showCommentForPage(p_id);
%>
<!-- 数据库连接 -->
</head>
<body>
	<div class="container_12">
		<div id="top">
			<div class="grid_3">
				<div class="phone_top">Call CN +110</div>
				<!-- .phone_top -->
			</div>
			<!-- .grid_3 -->

			<div class="grid_6">
				<div class="welcome">
					<%
						if (session.getAttribute("userSession") != null) {
					%>
					上次登录的时间:<%=session.getAttribute("lasttime")%>
					&nbsp;&nbsp;&nbsp;当前在线人数:<%=OnlineCounter.getOnline()%>
					<%
						}
					%>
				</div>
				<!-- .welcome -->
			</div>
			<!-- .grid_6 -->

			<div class="grid_3"></div>
			<!-- .grid_3 -->
		</div>
		<!-- #top -->

		<div class="clear"></div>

		<header id="branding">
			<div class="grid_3">
				<hgroup>
					<h1 id="site_logo">
						<a href="index.jsp" title=""><img height="119.8" width="130.8"
							src="images/login.jpg" alt="Online Store Theme Logo" /></a>
					</h1>
					<h2 id="site_description">年轻人的第一个游戏网</h2>
				</hgroup>
			</div>
			<!-- .grid_3 -->

			<div class="grid_3">
				<form class="search" action="catalog_search.jsp" method="post">
					<input type="text" name="search" class="entry_form" value=""
						placeholder="寻找游戏" />&nbsp;
				</form>
			</div>
			<!-- .grid_3 -->

			<div class="grid_6">
				<ul id="cart_nav">
					<li><a class="cart_li" href="shop_cart.jsp"><span>购物车</span></a>
					</li>
				</ul>

				<nav class="private">
					<ul>
						<%
							if (session.getAttribute("userSession") == null) {
						%>
						<li><a href="login.jsp">登录</a></li>
						<li class="separator">|</li>
						<li><a href="Create user.jsp">注册</a></li>
						<%
							} else {
						%>
						<li><a href="##.jsp">用户(<%=session.getAttribute("username")%>)身份(<%=session.getAttribute("userSession")%>)
						</a>
						<li class="separator">|</li>
						<%
							if (session.getAttribute("userSession").equals("管理员")) {
						%><li><a
							href="admin/ht.jsp"><span>后台</span></a></li>
						<%
							}
						%>
						<%
							if (session.getAttribute("userSession").equals("客户")) {
						%><li><a
							href="Personal.jsp"><span>个人信息</span></a></li>
						<%
							}
						%>
						<li class="separator">|</li>
						<li><a href="deal/logout.jsp">[注销]</a></li>
						<%
							}
						%>
					</ul>
				</nav>
				<!-- .private -->
			</div>
			<!-- .grid_6 -->
		</header>
		<!-- #branding -->
	</div>
	<!-- .container_12 -->

	<div class="clear"></div>

	<div id="block_nav_primary">
		<div class="container_12">
			<div class="grid_12">
				<nav class="primary">
					<ul>
						<li class="curent"><a href="index.jsp">首页</a></li>
						<li><a href="blog_post.jsp">新闻</a></li>
						<li><a href="catalog_grid.jsp">类型</a></li>
						<%
							if (pl2.size() > 0) {
								for (int i = 0; i < pl2.size(); i++) {
									main_type pd2 = (main_type) pl2.get(i);
						%>
						<li><span><a
								href="catalog_grid.jsp?type=<%=pd2.getT_id()%>"><%=pd2.getT_type()%></a></span></li>
						<%
							}
							} else {
						%>
						<li><span><a href="#">没有产品区</a></span></li>
						<%
							}
						%>
					</ul>
					</li>
					</ul>
				</nav>
				<!-- .primary -->
			</div>
			<!-- .grid_12 -->
		</div>
		<!-- .container_12 -->
	</div>
	<!-- .block_nav_primary -->

	<div class="clear"></div>

	<div class="container_12">
		<div class="grid_12">
			<div class="breadcrumbs">
				<a href="index.jsp">主页</a><span>&#8250;</span><a href="#">类型</a><span>&#8250;</span><span
					class="current"><%=pd.getP_type()%></span>
			</div>
			<!-- .breadcrumbs -->
		</div>
		<!-- .grid_12 -->
	</div>
	<!-- .container_12 -->

	<div class="clear"></div>

	<section id="main">
		<div class="container_12">
			<div id="sidebar" class="grid_3">
				<aside id="categories_nav">
					<h3>类型</h3>

					<nav class="left_menu">
						<ul>
							<%
								if (pl2.size() > 0) {
									for (int i = 0; i < pl2.size(); i++) {
										main_type pd2 = (main_type) pl2.get(i);
										int total = pt.countPD(pd2.getT_type());
							%>
							<li><a href="catalog_grid.jsp?type=<%=pd2.getT_id()%>"><%=pd2.getT_type()%><span>(<%=total%>)
								</span></a></li>
							<%
								}
								} else {
							%>
							<li><span><a href="#">没有产品区</a></span></li>
							<%
								}
							%>
						</ul>
					</nav>
					<!-- .left_menu -->
				</aside>
				<!-- #categories_nav -->


			</div>
			<!-- .sidebar -->

			<div id="content" class="grid_9">
				<h1 class="page_title"><%=pd.getP_name()%></h1>
				<title>游戏：<%=pd.getP_name()%></title>
				<div class="product_page">

					<div class="grid_4 img_slid" id="products">
						<img class="sale" src="images/sale.png" alt="Sale" />

						<div class="preview slides_container">
							<div class="prev_bg">
								<a href="<%=pd.getP_image()%>" class="jqzoom" rel='gal1'
									title=""> <img src="<%=pd.getP_image()%>" title="" alt="" />
								</a>
							</div>
						</div>
						<!-- .prev -->

					</div>
					<!-- .grid_4 -->

					<div class="grid_5">
						<div class="entry_content">

							<div class="ava_price">
								<div class="availability_sku"></div>
								<!-- .availability_sku -->

								<div class="price">
									<div class="price_new">
										$<%=pd.getP_price()%></div>
									<div class="sku">
										销量: <span><%=pd.getP_purchase()%></span>
									</div>
								</div>
								<!-- .price -->

							</div>
							<!-- .ava_price -->

							<div class="block_cart">


								<div class="cart">
									<a href="deal/cart_add.jsp?p_id=<%=pd.getP_id()%>" class="bay">放到购物车</a>
									<input type="text" name="" class="number" value="1" /> <span>数量:</span>
								</div>
								<div class="clear"></div>
							</div>
							<!-- .block_cart -->

						</div>
						<!-- .entry_content -->

					</div>
					<!-- .grid_5 -->

					<div class="clear"></div>

					<div class="grid_9">
						<div id="wrapper_tab" class="tab1">
							<a href="#" class="tab1 tab_link">产品情况</a>
							<div class="clear"></div>

							<div class="tab1 tab_body"
								style="color: #00F; font-weight: bold;" align="center"><%=pd.getP_description()%><div
									class="clear"></div>
							</div>
							<!-- .tab1 .tab_body -->

							<div class="clear"></div>
						</div>
						​
						<!-- #wrapper_tab -->
						<div class="clear"></div>




						<div style="margin: 0px auto;" class="keleyitable">
							<!--留言区  -->
							<div id="wrapper_tab" class="tab1">
								<a href="#" class="tab1 tab_link">留言列表</a>


								<%
									if (commentList.size() > 0) {
										for (int i = 0; i < commentList.size(); i++) {
											Comment comment = (Comment) commentList.get(i);
								%>
								<table style="background-color: #ECEDE9;" rules="none">
									<tr>
										<td width="25%" align="left" class="klytd">&nbsp;留言时间：<%=comment.getWirtetime()%></td>
										<td width="50%" class="klytd" align="center">第<%=i + 1%>条评论&nbsp;内容
										</td>
										<td width="25%" align="center" class="hvttd">&nbsp;留言人：<b
											style="color: #00F;"><%=comment.getWirteName()%></b></td>
									</tr>
									<tr>
										<td width="100%" colspan="3" class="hvttd">&nbsp;<%=comment.getContents()%></td>
									</tr>
									<tr>
										<td width="100%" colspan="3" class="hvttd" align="center">评论级数1-10级:<b
											style="color: #F00;"><%=comment.getGrade()%></b></td>
									</tr>
								</table>
								<%
									}
									} else {
								%>
								<table
									style="font-weight: bold; border: 2px solid #69F; margin-top: 20px;">
									<tr>
										<td>暂无评论</td>
									</tr>
								</table>
								<%
									}
								%>


							</div>
							​
							<!-- #wrapper_tab -->


							<form name="form1" class="contact"
								action="deal/do_Commment.jsp?p_ID=<%=pd.getP_id()%>"
								method="post" onSubmit="return fun_check_form()">

								<div id="wrapper_tab" class="tab1">
									<a href="#" class="tab1 tab_link">提交留言</a>
									<table>
										<tr>
											<td width="7%">内容：</td>
											<td><textarea name="text" id="text"
													style="width: 600px; height: 200px; resize: none;"></textarea></td>
										</tr>
										<tr>
											<td></td>
											<td>评级：(1到10)<input type="text" name="grade" id="grade"></td>
										</tr>
										<tr>
											<td></td>
											<td align="center"><input type="submit" name="B1"
												value="提交" /></td>
										</tr>
									</table>
								</div>
								​
								<!-- #wrapper_tab -->

							</form>

						</div>
						<!--留言区 -->
					</div>
					<!-- .grid_9 -->
					<div class="clear"></div>

					<div class="related">
						<div class="c_header">
							<div class="grid_7">
								<h2>同类型游戏</h2>
							</div>
							<!-- .grid_7 -->

							<div class="grid_2">
								<a id="next_c1" class="next arows" href="#"><span>Next</span></a>
								<a id="prev_c1" class="prev arows" href="#"><span>Prev</span></a>
							</div>
							<!-- .grid_2 -->
						</div>
						<!-- .c_header -->

						<div class="list_carousel">

							<ul id="list_product" class="list_product">

								<%
									if (P2.size() > 0) {
										for (int i = 0; i < P2.size(); i++) {
											Product pd2 = (Product) P2.get(i);
								%>
								<li class="">
									<div class="grid_3 product">
										<div class="prev">
											<a href="showProductMessage.jsp?p_id=<%=pd2.getP_id()%>"><img
												src="<%=pd2.getP_image()%>" alt="" title="" /></a>
										</div>
										<!-- .prev -->
										<h3 class="title"><%=pd2.getP_name()%></h3>
										<div class="cart">
											<div class="price">
												<div class="vert">
													<div class="price_new">
														$<%=pd2.getP_price()%></div>
												</div>
											</div>
											<a href="#" class="obn"></a> <a href="#" class="like"></a> <a
												href="deal/cart_add.jsp?p_id=<%=pd2.getP_id()%>"
												class="bay"></a>
										</div>
										<!-- .cart -->
									</div>
									<!-- .grid_3 -->
								</li>
								<%
									}
									} else {
								%>
								<tr>
									<td height="26" colspan="2"><a href="#" class="dong06">暂无</a></td>
								</tr>
								<tr>
									<td colspan="2"><img src="image/d03.jpg" width="352"
										height="1" /></td>
								</tr>
								<%
									}
								%>

							</ul>
							<!-- #list_product -->
						</div>
						<!-- .list_carousel -->
					</div>
					<!-- .carousel -->
				</div>
				<!-- .product_page -->
				<div class="clear"></div>

			</div>
			<!-- #content -->

			<div class="clear"></div>

		</div>
		<!-- .container_12 -->
	</section>
	<!-- #main -->

	<div class="clear"></div>

	<footer>
		<div class="f_info">
			<div class="container_12">
				<div class="grid_6">
					<p class="copyright">BY 417工作室, 2015</p>
				</div>
				<!-- .grid_6 -->

				<div class="grid_6">
					<div class="soc"></div>
					<!-- .soc -->
				</div>
				<!-- .grid_6 -->

				<div class="clear"></div>
			</div>
			<!-- .container_12 -->
		</div>
		<!-- .f_info -->
	</footer>

</body>
<!-- Added by HTTrack -->
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<!-- /Added by HTTrack -->
</html>
